<template>
<div>
  <van-field v-model="query.username" label="姓名"  placeholder="请输入姓名" input-align="right"/>
  <van-field v-model="query.mobile" label="联系电话"  placeholder="请输入联系电话" input-align="right"/>
  <van-field v-model="query.company_name" label="目标企业"  placeholder="输入目标企业" input-align="right"/>
  <van-cell title="需求类型" :value="query.type" @click="openC"/>
  <!-- <van-field v-model="query.type" label="需求类型"  placeholder="输入框内容右对齐" input-align="right"/> -->
  <van-popup v-model="show" position="bottom">
    <van-picker
      title="需求类型"
      show-toolbar
      :columns="typeList"
      @confirm="onConfirm"
      @cancel="onCancel"/>
  </van-popup>
  <div class="flex_sb div_yl">
    <div>价格：<span class="red">5000元</span></div>
    <a href="http://cq.parkic.com/1.pdf" target="_blank">查看样例</a>
  </div>
  <div class="tj_btn btn" @click="submit">提交</div>
</div>
</template>
<script>
import {ApplycomreportAdd} from '@/api/api'
export default {
  data(){
    return{
      query: {
        company_name:'',
        type: '企业尽调报告',
        mobile:'',
        username:'',
        identification:''
      },
      typeList: ['企业尽调报告','委托精准对接'],
      show:false,
    }
  },
  created(){
    this.query.username = localStorage.nickname
    this.query.mobile = localStorage.mobile
    this.query.company_name = this.$route.query.company_name
    this.query.identification = this.$route.query.identification
  },
  methods:{
    openC(){
      this.show=true
    },
    onConfirm(val){
      this.query.type = val
      this.show=false
    },
    onCancel(){
      this.show=false
    },
    submit(){
      if(!this.query.company_name||!this.query.username||!this.query.mobile){
        this.$Message.error('请输入完整信息')
        return
      }
      ApplycomreportAdd(this.query).then(res=>{
        this.$Message.success(res.msg)
        this.$router.go(-1)
      }).catch(err=>{
        this.$Message.error(err)
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.div_yl{
  padding: 1rem;
  .red{
    color: rgb(177, 10, 10);
  }
}
.tj_btn{
  margin: 20px 16px;
  width: calc(100% - 32px);
  height: 42px;
  line-height: 42px;
  border-radius: 21px;
  background: #f93;
  color: #fff;
  font-size: 18px;
  text-align: center;
}
</style>